package com.uubx.mapper;

import com.uubx.pojo.Information;
import com.uubx.vo.BatchVo;
import com.uubx.vo.InformationVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface InformationMapper {
    //通过id查询资讯信息
    @Select("SELECT id,lasttime,number,title,category,recommend,puttime,removetime,STATUS,content FROM information WHERE id=#{id}")
    Information queryInformationById(Long id);

    //添加资讯信息
    void saveInformation(Information information);
    //编辑资讯信息
    void updateInformation(Information information);
    //分页查询
    List<Map> queryAllInformation(InformationVo informationVo);
    //通过id删除
    @Delete("delete from information where id=#{id}")
    void deleteInformationById(Long id);
    //按照降序查询表中number字段取第一条数据并返回(查询表中最后一条数据)
     @Select(" SELECT number FROM information ORDER BY number DESC LIMIT 1")
    Long queryInformationLastByNumber();
     //查询总记录数
    @Select("select count(*) from information")
    Long queryInformationCount();
    //批量删除
   void BatchDeleteInformation(BatchVo batchVo);


}
